package com.catchpig.fund.domain.repository

import com.catchpig.fund.domain.entity.ExcellentFund
import com.catchpig.fund.domain.enums.FundType
import com.catchpig.fund.domain.enums.OrderByFilter
import com.catchpig.fund.domain.network.api.FundService
import com.catchpig.mvvm.network.manager.NetManager
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow

object FundRepository {
    private val fundService = NetManager.getService(FundService::class.java)

    fun getStockExcellentFunds(): Flow<MutableList<ExcellentFund>> {
        return flow {
            val pageData = fundService.getExcellentFunds(
                FundType.STOCK.value,
                OrderByFilter.YEAR_3.value,
                50,
                1
            )
            emit(pageData.items)
        }
    }
}